package jdbc;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class JdbcDemo9
{
    public static void main(String[] args)
    {
        try(Connection connection = DBUtil.getConnection())
        {
            String sql = "delete from userinfo1 where id = ?";
            PreparedStatement preparedStatement = connection.prepareStatement(sql);
            preparedStatement.setInt(1,2);
            int i = preparedStatement.executeUpdate();
            if (i > 0)
            {
                System.out.println("update successfully");
            }else {
                System.out.println("............");
            }
        }catch (SQLException e)
        {
            e.printStackTrace();
        }
    }
}
